<?php
namespace Amis\functions;

use Amis\Basics\AmisBasics;

class TooltipWrapper extends AmisBasics
{
    public string $type = 'tooltip-wrapper';


    public function className($className)
    {
        $this->className = $className;
        return $this;
    }

    public function title($title)
    {
        $this->title = $title;
        return $this;
    }

    public function content($content)
    {
        $this->content = $content;
        return $this;
    }

    public function placement($type)
    {
        if (in_array($type, ["top", "left", "right", "bottom"])) {
            $this->placement = $type;
        }
        return $this;
    }

    public function tooltipTheme($type)
    {
        if (in_array($type, ["light", "dark"])) {
            $this->tooltipTheme = $type;
        }
        return $this;
    }

    public function offset($left_number = 0, $right_number = 0)
    {
        $this->offset = [$left_number, $right_number];
        return $this;
    }

    public function showArrow(bool $showArrow = true)
    {
        $this->showArrow = $showArrow;
        return $this;
    }

    public function enterable(bool $enterable = true)
    {
        $this->enterable = $enterable;
        return $this;
    }

    public function disabled(bool $disabled = true)
    {
        $this->disabled = $disabled;
        return $this;
    }

    /**
     * @param string|array $type
     * @return $this
     */
    public function trigger($type)
    {
        if (in_array($type, ["hover", "click", "focus"])) {
            $this->trigger = $type;
        }
        return $this;
    }

    public function mouseEnterDelay(int $mouseEnterDelay = 0)
    {
        $this->mouseEnterDelay = $mouseEnterDelay;
        return $this;
    }

    public function mouseLeaveDelay(int $mouseLeaveDelay = 0)
    {
        $this->mouseLeaveDelay = $mouseLeaveDelay;
        return $this;
    }

    public function rootClose(bool $rootClose = true)
    {
        $this->rootClose = $rootClose;
        return $this;
    }

    public function inline(bool $inline = false)
    {
        $this->inline = $inline;
        return $this;
    }

    public function wrapperComponent($wrapperComponent = 'div')
    {
        $this->wrapperComponent = $wrapperComponent == 'div' ?: 'span';
        return $this;
    }

    public function body(array $body)
    {
        $this->body = $body;
        return $this;
    }

    public function style($style)
    {
        $this->style = $style;
        return $this;
    }

    public function tooltipStyle($tooltipStyle)
    {
        $this->tooltipStyle = $tooltipStyle;
        return $this;
    }

    public function tooltipClassName(string $tooltipClassName)
    {
        $this->tooltipClassName = $tooltipClassName;
        return $this;
    }
}